package com.base.controller;

import com.base.service.EmpiMergeInfoService;
import com.base.utils.Result;
import com.base.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wnhuang
 * @Package com.base.controller
 * @date 2021-02-22 16:14
 */
@RestController
@RequestMapping(value = "/callable")
public class EmpiCallableController {

    @Autowired
    EmpiMergeInfoService empiMergeInfoService;

    @GetMapping("/getMergeLog/{batchId}")
    public Result getMergeLog(@PathVariable("batchId") String batchId){
        return ResultUtil.success(empiMergeInfoService.getEmpiMergeLogByBatchId(batchId));
    }

    @GetMapping("/propAutoMerge/{batchId}")
    public Result propAutoMerge(@PathVariable("batchId") String batchId){
        empiMergeInfoService.callable(batchId);
        return ResultUtil.success();
    }

    @GetMapping("/getMergeInfo")
    public Result getMergeInfo(){
        return ResultUtil.success(empiMergeInfoService.list());
    }

    @GetMapping("/getUnMergeCount")
    public Result getUnMergeCount(){
        return ResultUtil.success(empiMergeInfoService.getUnMergeCount());
    }

}
